﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace DCTAccess.Business.Search
{
    public class Search
    {
        #region Property
        private int _id = -1;
        private string _title = string.Empty;
        private string _services = string.Empty;
        private string _location = string.Empty;
        private string _price = string.Empty;
        private string _priceTo = string.Empty;
        private int _viewNum = -1;
        private string _datePost = string.Empty;
        private string _imagesPost = string.Empty;
        private string _need = string.Empty;
        private string _locationCity = string.Empty;
        
        
        public int Id
        {
            get { return _id; }
            set { _id = value; }
        }
        

        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }
        

        public string Services
        {
            get { return _services; }
            set { _services = value; }
        }
        

        public string Location
        {
            get { return _location; }
            set { _location = value; }
        }
       

        public string Price
        {
            get { return _price; }
            set { _price = value; }
        }

       

        public string PriceTo
        {
            get { return _priceTo; }
            set { _priceTo = value; }
        }

        

        public int ViewNum
        {
            get { return _viewNum; }
            set { _viewNum = value; }
        }
        

        public string DatePost
        {
            get { return _datePost; }
            set { _datePost = value; }
        }
        

        public string ImagesPost
        {
            get { return _imagesPost; }
            set { _imagesPost = value; }
        }

        

        public string Need
        {
            get { return _need; }
            set { _need = value; }
        }

        

        public string LocationCity
        {
            get { return _locationCity; }
            set { _locationCity = value; }
        }
        #endregion

        public Search() { }

        public Search(DataRow searchResult)
        {
            this.Id = Convert.ToInt32(searchResult["LocationID"].ToString());
            this.Title = searchResult["ProductName"].ToString();
            this.Services = searchResult["NeedsName"].ToString();
            this.Location = searchResult["ParentName"].ToString();
            this.Price = searchResult["Price"].ToString();
            this.PriceTo = searchResult["Price"].ToString();
            this.ViewNum = Convert.ToInt32(searchResult["ViewTime"].ToString());
            this.DatePost = searchResult["CreateDate"].ToString();
            this.ImagesPost = searchResult["ProductImage"].ToString();
            this.Need = searchResult["NeedsName"].ToString();
            this.LocationCity = searchResult["ParentName"].ToString();
        }
    }
}
